/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package it.bbSimulator.Controller;

import it.bbSimulator.Model.Panels.PanelColor;
import it.bbSimulator.Model.Bank.Bank;
import it.bbSimulator.Model.Panels.Panel;
import it.bbSimulator.Model.Panels.*;
import it.bbSimulator.Model.eWallet.Ewallet;
import java.util.ArrayList;
import java.util.HashMap;

/**
 *
 * @author Massimo
 */
public class Controller {
    PanelBank pBank;
    ArrayList<Bank> trafficPackBank;
    ArrayList<Bank> salesBank;
    ArrayList<Bank> allowancesBank;
    Ewallet ewallet;
    
    
    /**
     * Purchase new panels
     * @param t color of new panels
     * @param n number of purchased panels
     */
    public void purchase(PanelColor t,int n){
        Panel p;
        for(int i=0;i<n;i++){
            p=new Panel(t,PanelType.PURCHASE);
            pBank.AddPanel(p);
            ewallet.addMoney(-p.getTarget()/2);
        }
    }
    
    /**
     * merge 3 or multiple into a next-step panels
     * @param t panels color to merge
     * @param n number of panels to merge (must be 3 or multiple)
     * @return true if success
     */
    public boolean rollup(PanelColor t,int n){
        if(n%3!=0)
            return false;
        pBank.getFilteredPanels(t, PanelState.LOCKED);
        return false;
    }
    
    public boolean qualify(int id){
        return false;
    }
    
    public void lock(int id){
        
    }
}
